﻿@model IEnumerable<IRIS.Models.EventCal>

@{
    ViewBag.Title = "Atburðir";
}
@section SubMenu
{
    <ul>    
        <li>@Html.ActionLink("Janúar", "Date", "Events", new { theMonth = 1, theYear=DateTime.Now.Year , theMonthName = "Janúar" },null)</li>
        <li>@Html.ActionLink("Febrúar", "Date", "Events", new { theMonth = 2, theYear = DateTime.Now.Year, theMonthName = "Febrúar" }, null)</li>
        <li>@Html.ActionLink("Mars", "Date", "Events", new { theMonth = 3, theYear=DateTime.Now.Year , theMonthName = "Mars" },null)</li>
        <li>@Html.ActionLink("Apríl", "Date", "Events", new { theMonth = 4, theYear = DateTime.Now.Year, theMonthName = "Apríl" }, null)</li>
        <li>@Html.ActionLink("Maí", "Date", "Events", new { theMonth = 5, theYear = DateTime.Now.Year, theMonthName = "Maí" }, null)</li>
        <li>@Html.ActionLink("Júní", "Date", "Events", new { theMonth = 6, theYear = DateTime.Now.Year, theMonthName = "Júní" }, null)</li>
        <li>@Html.ActionLink("Júlí", "Date", "Events", new { theMonth = 7, theYear = DateTime.Now.Year, theMonthName = "Júlí" }, null)</li>
        <li>@Html.ActionLink("Ágúst", "Date", "Events", new { theMonth = 8, theYear = DateTime.Now.Year, theMonthName = "Ágúst" }, null)</li>
        <li>@Html.ActionLink("September", "Date", "Events", new { theMonth = 9, theYear = DateTime.Now.Year, theMonthName = "September" }, null)</li>
        <li>@Html.ActionLink("Október", "Date", "Events", new { theMonth = 10, theYear = DateTime.Now.Year, theMonthName = "Október" }, null)</li>
        <li>@Html.ActionLink("Nóvember", "Date", "Events", new { theMonth = 11, theYear = DateTime.Now.Year, theMonthName = "Nóvember" }, null)</li>
        <li>@Html.ActionLink("Desember", "Date", "Events", new { theMonth = 12, theYear=DateTime.Now.Year, theMonthName = "Desember" },null)</li>
    </ul>
}

<h2>Atburðir</h2>
<table>
    <tr>
        <th>Titill</th>
        <th>Dagsetning</th>
        <th>Staðsetning</th>
        @if (User.IsInRole("Stjórnendur"))
         {
            <th>Stjórnborð</th>
         }
    </tr>

   
    @foreach (var item in Model)
    {
        <tr>
            <td>@Html.ActionLink(item.Title, "Details", new { id = item.ID })</td> 
            <td>@item.EventDate.ToString("dd.MM.yyyy HH:mm")</td>
            <td>@item.Location</td>
            @if (User.IsInRole("Stjórnendur"))
            {
             <td>@Html.ActionLink("Edit", "Edit", new { id = item.ID, delete = false }) |
                @Html.ActionLink("Delete", "Edit", new { id = item.ID, delete = true })
             </td>
            }   
        </tr>
    }
    
</table>
